package br.com.fidalgotecnologia.layar.json;




import org.json.JSONException;
import org.json.JSONObject;

import br.com.fidalgotecnologia.layar.entity.Object;
import br.com.fidalgotecnologia.layar.entity.Transform;

public class TransformJson  {
	private Transform transform;
    private JSONObject json;
    
    public TransformJson(Transform transform){
    	this.transform = transform;
    	json = new JSONObject();
    	try {
			json.put( "rotate",new RotationJson(this.transform.getRotate()).getJson());
			json.put( "translate",new AxisJson(this.transform.getTranslate()).getJson());
			json.put( "scale",this.transform.getScale());
		
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
    
   public JSONObject getJson() {
	return json;
}
    
	@Override
	public String toString() {
		String retorno = null;
		
		try {
			
			retorno = json.toString();
		} catch (Exception  e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return retorno;
	}

}